package com.example.mall.exception;

import lombok.Getter;

public class GlobalCustomerException extends RuntimeException{

    //定义错误码
    @Getter
    private String code;

    //自定义错误码以及错误描述
    public GlobalCustomerException(String message, String code) {
        super(message);
        this.code = code;
    }

    //默认异常,未知错误
    public GlobalCustomerException(ErrorEnumCode errorEnumCode) {
        this(errorEnumCode.getDescription(),String.valueOf(errorEnumCode.getCode()));
    }

}
